Classes
Position​
- C++
- Python
- Java
int get_x()
int get_y()
double distance_to(Position)
x: int
y : int
distance_to(Position): float
int getX()
int getY()
double distanceTo(Position other)
Attacker​
- C++
- Python
- Java
size_t get_hp()
size_t get_id()
size_t get_type()
Position get_position()
hp: int
id: int
type: AttackerType
position: Position
int getId()
int getHp()
int getType()
Position getPosition()
Defender​
- C++
- Python
- Java
size_t get_hp()
size_t get_id()
size_t get_type()
Position get_position()
hp: int
id: int
type: DefenderType
position: Position
int getId()
int getHp()
int getType()
Position getPosition()
State​
- C++
- Python
- Java
const std::vector<Attacker>& get_attackers()
const std::vector<Defender>& get_defenders()
size_t get_turn_no()
size_t get_coins_left()
attackers: List[Attacker]
defenders: List[Defender]
turn_no: int
no_of_coins_left: int
List<Attacker> getAttackers()
List<Defender> getDefenders()
int getTurnNo()
int getCoinsLeft()
Game​
- C++
- Python
- Java
void spawn_attacker(size_t type_id, Position pos)
: Spawns Attacker of type type_id at Position posbool already_spawned_at_position(Position pos)
: Given a Position pos, it will return whether some attacker was already spawned in that position in the current turnvoid set_target(size_t attacker_id, size_t defender_id)
: Sets the target for Attacker with id=attacker_id as Defender with id=defender_id. If the defender_id is invalid, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackervoid set_target(const Attacker &attacker, const Defender &defender)
: Sets the target for Attacker(attacker) as Defender(defender). If the defender is invalid somehow, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackerstd::ostringstream &logr()
: Given a Game object(called game), you can dogame.logr()<<"Log This\n";
and it will be shown in the renderer logs when the game is being renderedconst std::unordered_map<size_t, size_t> &get_player_set_targets()
const std::vector<std::pair<size_t, Position>> &get_spawn_positions()
const std::set<Position> &get_already_spawned_positions() const
spawn_attacker(type_id: int, position: Position)
: Spawns Attacker of type type_id at Position posis_already_spawned_at_position(position: Position): bool
: Given a Position pos, it will return whether some attacker was already spawned in that position in the current turnset_target(attacker_id: int, defender_id: int)
: Sets the target for Attacker with id=attacker_id as Defender with id=defender_id. If the defender_id is invalid, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackerlog(line: str)
:Given a Game object(called game), you can dogame.log("Log This\n")
and it will be shown in the renderer logs when the game is being renderedclear_log()
player_set_targets: Dict[int, int]
spawn_positions: List[Tuple[int, Position]]
already_spawned_positions: Set[Position]
void spawnAttacker(int type_id, Position pos)
: Spawns Attacker of type type_id at Position posboolean alreadySpawnedAtPosition(Position pos)
: Given a Position pos, it will return whether some attacker was already spawned in that position in the current turnvoid setTarget(int attacker_id, int defender_id)
: Sets the target for Attacker with id=attacker_id as Defender with id=defender_id. If the defender_id is invalid, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackervoid setTarget(Attacker attacker, Defender defender)
: Sets the target for Attacker(attacker) as Defender(defender). If the defender is invalid somehow, the simulator will handle that automatically and try to set the target which is at the nearest position to the Attackervoid log(String s)
Given a Game object(called game), you can dogame.log("Log This\n")
and it will be shown in the renderer logs when the game is being renderedvoid clearLog()
List<SpawnDetail> getSpawnPositions()
Map<Integer, Integer> getPlayerSetTargets()
AttackerType (Python Specific)​
hp: int
range: int
attack_power: int
price: int
speed: int
is_aerial: int
DefenderType (Python Specific)​
hp: int
range: int
attack_power: int
price: int
is_aerial: int
Attributes (C++ and Java Specific)​
This class stores the attributes for Attacker
and Defender
. This will be used as the value type in Constants for storing attributes of Attacker and Defender types.
- C++
- Java
unsigned hp
unsigned range
unsigned attackPower
unsigned speed
(to be ignored for Defender)unsigned price
unsigned is_aerial
int hp
int range
int attack_power
int speed
(to be ignored for Defender)int price
int is_aerial
SpawnDetail (Java Specific)​
int getTypeId()
: Returns the typeId of the spawnPosition getPos()
: Returns the position of the spawn